<template>
	<view>
		<uni-popup ref="popup" type="center" border-radius="10px 10px 10px 10px" @maskClick="handleConfigClick(false)">
			<view class="prompt_box">
				<image src="https://img.jinghushi.com/images/9/2025/10/GLWOamgLkAO4zlh4GW5h3H5Q4qK44H.png"></image>
				<view class="">{{msg.title}}</view>
				<view class="msg">{{msg.content}}</view>
				<view class="btns">
					<view class="btn1" @click="handleConfigClick(false)">{{msg.cancel}}</view>
					<view class="btn2" @click="handleConfigClick(true)">{{msg.config}}</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		props: [],
		data() {
			return {
				msg: {
					title: '使用确认',
					content: '',
					cancel: '取消操作',
					config: '确认使用'
				}
			}
		},
		methods: {
			open(msg) {
				this.msg = {
					...this.msg,
					...msg
				};
				setTimeout(() => {
					this.$refs.popup.open()
				}, 1)
			},
			close() {
				this.$refs.popup.close();
			},
			handleConfigClick(e) {
				this.$emit('config', e)
				this.close()
			}
		}
	}
</script>

<style lang="scss">
	.prompt_box {
		width: 574rpx;
		height: 556rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		padding: 30rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;

		image {
			width: 206rpx;
			height: 206rpx;

		}

		.tit {
			color: #13001E;
			font-size: 32rpx;
			font-weight: bold;
		}

		.msg {
			color: #5B5B5B;
			font-size: 24rpx;
			text-align: center;
			margin: 20rpx 0;
		}

		.btns {
			width: 100%;
			// background-color: pink;
			display: flex;
			// align-items:;
			justify-content: space-between;
			margin-top: 20rpx;

			view {
				width: 248rpx;
				height: 86rpx;
				border-radius: 16rpx;
				font-size: 28rpx;
				line-height: 86rpx;
				text-align: center;
			}

			.btn1 {
				background: #f0defc;
				color: #9A1FE8;
			}

			.btn2 {
				color: #FFFFFF;
				background: #9A1FE8;
			}
		}
	}
</style>